{
  "$schema" : "http://json-schema.org/draft/2019-09/schema#",
  "title" : "External Trigger",
  "type" : "object",
  "additionalProperties" : false,
  "properties" : {
    "interfaceCategory" : {
      "type" : "string",
      "enum" : [ "COMMS" ],
      "description" : "CMP categorisation of the job associated with this file."
    },
    "interfaceType" : {
      "type" : "string",
      "enum" : [ "EXTERNAL_TRIGGER" ],
      "description" : "Sub-categorisation of the job"
    },
    "version" : {
      "type" : "number",
      "minimum" : 1.0,
      "maximum" : 1.0,
      "description" : "The current version of the generic extract file. This must match the corresponding outbound file."
    },
    "transmitDateTime" : {
      "type" : "string",
      "format" : "date-time",
      "description" : "This is the time that the external system created/transmitted the trigger"
    },
    "channel" : {
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 20,
      "description" : "This uniquely identifies the external system that is sending in the trigger."
    },
    "hierarchyEntity" : {
      "$ref" : "#/definitions/HierarchyEntity",
      "description" : "This represents whether the customer reference is referring to an Account or Subscription."
    },
    "uniqueReference" : {
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 100,
      "description" : "This uniquely represents the trigger. This is used for audit purposes only."
    },
    "triggerId" : {
      "type" : "string",
      "maxLength" : 100,
      "description" : "This supplied Trigger id"
    },
    "attributes" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/Attribute"
      }
    },
    "serialNumber" : {
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 25,
      "description" : "Serial number for the notification."
    }
  },
  "required" : [ "interfaceCategory", "interfaceType", "version", "channel", "triggerId" ],
  "definitions" : {
    "HierarchyEntity" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "subscriptionId" : {
          "type" : "integer",
          "minimum" : 1,
          "maximum" : 99999999,
          "description" : "The subscription Number of the entity that the comms relates to."
        },
        "accountId" : {
          "type" : "integer",
          "minimum" : 1,
          "maximum" : 99999999,
          "description" : "The account Number of the entity that the comms relates to."
        },
        "corporateId" : {
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 6,
          "description" : "The corporate Code of the entity that the comms relates to."
        },
        "groupId" : {
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 6,
          "description" : " The group Code of the entity that the comms relates to."
        }
      }
    },
    "Attribute" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "attributeName" : {
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 50,
          "description" : "The attribute name."
        },
        "attributeValue" : {
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 100,
          "description" : "The attribute value."
        }
      },
      "required" : [ "attributeName", "attributeValue" ]
    }
  }
}